package com.dmm.order.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dmm.order.entity.OrderDetail;
import com.dmm.order.entity.OrderInfo;
import com.dmm.order.service.OrderInfoService;
import com.dmm.result.Result;
import com.dmm.vo.order.OrderInfoQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单表 订单表 前端控制器
 * </p>
 *
 * @author dmm
 * @since 2022-09-18
 */
@RestController
@Api(tags = "订单信息")
@RequestMapping("/order/orderinfo")
public class OrderInfoController {

    @Resource
    OrderInfoService orderInfoService;

    @ApiOperation(value = "获取分页列表")
    @GetMapping("{page}/{limit}")
    public Result index(@ApiParam(name = "page", value = "当前页码", required = true)
                        @PathVariable Long page,
                        @ApiParam(name = "limit", value = "每页记录数", required = true)
                        @PathVariable Long limit,
                        @ApiParam(name = "orderInfoVo", value = "查询对象", required = false)
                        @RequestBody OrderInfoQueryVo orderInfoQueryVo){

        Page<OrderInfo> pageParam =new Page<>(page,limit);

        Map<String,Object> map = orderInfoService.findPageOrderInfo(pageParam, orderInfoQueryVo);
        return Result.success(map);
    }

    @ApiOperation("测试连接")
    @GetMapping("/testData")
    public Result testData(){
        List<OrderInfo> list = orderInfoService.list();
        return Result.success(list);
    }



}

